from django.shortcuts import render, HttpResponse
import json


# Create your views here.

def ajax_jquery(req):
    print("ajax jquery")
    return render(req, "ajax_jquery.html")


def jquery_get(req, *args, **kwargs):  # 问题，字典怎么处理。
    # print(req.POST)
    # print("hello world, jquery_get")
    func = req.GET.get("zgswlcom")
    a = req.GET.get("aaa")
    b = req.GET.get("bbb")
    c = req.GET.get("ccc")
    print(a)
    print(b)
    print(c)
    data = {
        'aaa': a,
        'bbb': b,
        'ccc': c,
    }
    # data = {
    #     'name': 'ACME',
    #     'shares': 100,
    #     'price': 542.23,
    # }
    # json_str = json.dumps(data)
    # print("func=", func)
    # print("json_str=", json_str)
    return HttpResponse("%s(%s)" % (func, json.dumps(data)))
